﻿<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<!DOCTYPE html>
<head th:include="common/common_head::commonHeader('dalaoyang')"></head>

<body>
    <div id="wrapper">

        <div th:include="common/navigation :: navigation"></div>

        <div id="page-wrapper" >
            <div id="page-inner">
			 <div class="row">
                    <div class="col-md-12">
                        <h1 class="page-header">
                            <span th:text="${TITLE}"></span><small>注意：修改文章需要重新选择标签</small>
                        </h1>
                    </div>
                </div> 
                 <!-- /. ROW  -->
              <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            文章信息
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-12">
                                    <form role="form" id="articleForm" th:action="@{/postEditArticle}" method="post">
                                        <input type="hidden" name="articleId" th:value="${articleInfo==null?0:articleInfo.articleId}">
                                        <div class="form-group">
                                            <label>文章标题</label>
                                            <input class="form-control" type="text" name="articleName" id="articleName" th:value="${articleInfo==null?'':articleInfo.articleName}" required>
                                        </div>
                                        <div class="form-group">
                                            <label>文章作者</label>
                                            <input class="form-control" type="text" name="articleAuthors"  id="articleAuthors" th:value="${articleInfo==null?'':articleInfo.articleAuthors}" required>
                                        </div>
                                        <div class="form-group">
                                            <label>是否置顶</label>
                                            <select class="form-control" name="articleIsTop" id="articleIsTop" required>
                                                <option value="Y" th:checked="${articleInfo==null?'false':articleInfo.articleIsTop=='Y'}">是</option>
                                                <option value="N"  th:checked="${articleInfo==null?'false':articleInfo.articleIsTop=='N'}">否</option>
                                            </select>
                                        </div>
                                        <div class="form-group">
                                            <label>文章所属标签（多个标签之间用逗号,分割，例如springboot,springcloud）</label>
                                            <input class="form-control" type="text" name="tagNames"  id="tagNames" required th:value="${tagNameS==null?'':tagNameS}">
                                        </div>

                                        <div class="form-group">
                                            <label>文章内容（建议使用编辑好的markdown格式直接粘贴）</label>
                                            <textarea class="form-control" rows="20" name="articleContent" id="articleContent" required
                                                      th:text="${articleInfo==null?'':articleInfo.articleContent}"></textarea>
                                        </div>

                                        <button class="btn btn-default" onclick="postArticle()">提交</button>
                                        <!--<button type="reset" class="btn btn-default">Reset Button</button>-->
                                    </form>
                                </div>
                                <!-- /.col-lg-6 (nested) -->
                            </div>
                            <!-- /.row (nested) -->
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
			<footer>
                <div th:include="common/footer :: footer"></div>
            </footer>
			</div>
             <!-- /. PAGE INNER  -->
            </div>
         <!-- /. PAGE WRAPPER  -->
        </div>

    <script type="text/javascript"  th:inline="javascript">
        function  postArticle(){
            $("#articleForm").validate({
                submitHandler:function(form){
                    alert("提交事件!");
                    form.submit();
                }
            });
        }


    </script>
</body>
</html>
